using Unity.VisualScripting;
using GameFramework.DataNode;

namespace LS.UGFUnits
{
    [UnitSurtitle("Event Property")]
    [UnitShortTitle("Get")]
    public sealed class GetEventProperty : EventUnit
    {
        [DoNotSerialize]
        public ValueOutput EventHandlerCount { get; private set; }

        [DoNotSerialize]
        public ValueOutput EventCount { get; private set; }
        
        
        protected override void Definition()
        {
            base.Definition();
            EventHandlerCount = ValueOutput<int>(nameof(EventHandlerCount));
            EventCount = ValueOutput<int>(nameof(EventCount));
        }

        protected override ControlOutput In(Flow flow)
        {
            flow.SetValue(EventHandlerCount, Target?.EventHandlerCount ?? 0);
            flow.SetValue(EventCount, Target?.EventCount ?? 0);
            return base.In(flow);
        }
    }
}